#include <buola/buola.h>

#if BUOLA_PLATFORM_LINUX

#include "cwebcamdriver.h"

namespace buola { namespace cvi {

CWebCamDriver::CWebCamDriver()
{
}

CWebCamDriver::~CWebCamDriver()
{
    for(auto d : mDevices)
        delete d.second;
}

CWebCamDevice *CWebCamDriver::Device(const io::CURI &pURI)
{
    CWebCamDevice *&lDevice=mDevices[pURI.Path()];
    
    if(!lDevice)
    {
        lDevice=new CWebCamDevice(pURI);
    }
    
    return lDevice;
}

CWebCamDriver &get_webcam_driver()
{
    static CWebCamDriver lDriver;
    
    return lDriver;
}

/*namespace cvi*/ } /*namespace buola*/ }

#endif
